package com.movie.ticket.sale.movieassembly.common;

import com.netflix.zuul.context.RequestContext;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @BelongsProject: movie-zuul
 * @BelongsPackage: com.movie.ticket.sale.moviezuul.filter
 * @Author: lyl
 * @CreateTime: 2020-12-15 11:39
 * @Description:
 */
@Component
public class Resolver {

    //获取前端传过来得到的token
    public static Integer getId(){
        //获取请求对象
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        Integer id = Integer.valueOf(request.getParameter("id"));
        String tel = request.getParameter("tel");
        Integer role = Integer.valueOf(request.getParameter("role"));
        //解析token
        //指定签名的时候使用的签名算法
        return id;
    }
        public static String getTel(){
        //获取请求对象
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        String tel = request.getParameter("tel");

        //解析token
        //指定签名的时候使用的签名算法
        return tel;
    }
    public static Integer getRole(){
        //获取请求对象
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        Integer role = Integer.valueOf(request.getParameter("role"));
        return role;
    }
}
